using System;
using Microsoft.Practices.PageFlow;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using TestWCSFSitemaps.Payments.Services;
using System.Web;

namespace TestWCSFSitemaps.Payments
{
    public class PaymentsController : IPaymentsController
    {
        INavigation navigationService;

        [InjectionConstructor]
        public PaymentsController([ServiceDependency]INavigation navigationService,
            [ProviderDependency(typeof(PageFlowDirectory))]IPageFlowProvider pageFlowProvider)
        {
            this.navigationService = navigationService;
            this.navigationService.PageFlowProvider = pageFlowProvider;
            
        }

        public void StartPageFlow()
        {
            if (navigationService.PaymentPageFlow.Status == PageFlowStatus.NotStarted)
                navigationService.PaymentPageFlow.Start();
            navigationService.PaymentPageFlow.SetCurrentPage(System.Web.SiteMap.CurrentNode.Key);
        }

        public string CurrentPage
        {
            get { return navigationService.PaymentPageFlow.CurrentPage.Name; }
            set { navigationService.PaymentPageFlow.SetCurrentPage(value); }
        }

        public void GoPayX()
        {
            navigationService.GoX();
        }

        public void GoPayY()
        {
            navigationService.GoY();
        }

        public void GoPayZ()
        {
            navigationService.GoZ();
        }
    }
}
